home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload Trio 2
/
Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO
/
dir43
/
med300.zip
/
MEMOEDIT.DOC
< prev
next >
Wrap
Text File
|
1994-02-22
|
22KB
|
668 lines
MemoEdit 3.00 for CDD
Copyright (C) 1994, by Bobcat Systems
All Rights Reserved
Bobcat Systems
PO Box 1195
Ossining, NY 10562
Information & Technical Support: (914)-762-2374
Fax/BBS: (914)-923-9335
CompuServe: [70441,204]
"O woe unto thee, for developing in CDD..." - Anon
1.0 LICENSE AND WARRANTY
-------------------------
MemoEdit is copyrighted material, (C) Bobcat Systems. You are granted
a limited license to MemoEdit under the following terms and
conditions:
(1) You may modify MemoEdit and incorporate into your applications
free of charge.
(2) You may freely distribute unmodified versions of the MemoEdit
source code to others.
(3) You may not distribute modified versions of the source code to
others without the express written consent of Bobcat Systems.
This software is provided without warranties of any kind, either
express or implied. In no event will Bobcat Systems be liable to you
for any damages incurred by its use.
2.0 OVERVIEW
-------------
MemoEdit provides memo and ASCII file editing capabilities in Clarion
3.0 applications. The following features are currently implemented:
* Editing keys based on Clarion Editor
* Real-time paragraph reformatting and text reflow
* Word-by-word movement
* Character-oriented block operations, similar to Clarion Editor
* ASCII file import/export
* Ability to use standard Clarion format memos
Keep in mind that MemoEdit is not meant to be a full-scale word
processor; its aims are modest.
If you need high-end word processing features (e.g. spellcheck,
bold/underline/italic, search/replace, WordPerfect import/export,
etc.), in your applications you should consider SuperMemo 3.0, our
commercial word processing add-on for CDD applications. Please
contact us for details.
3.0 PACKING LIST
-----------------
MEMOEDIT.DEC - MemoEdit global variable declarations
MEMOEDIT.EQU - MemoEdit equates
MEMOEDIT.MOD - MemoEdit procedure prototypes
MEDUMMY.CLA - INCLUDE() code for Generator dummy fields
MEMEDTST.APP - A rudimentary CDD Generator example app using MemoEdit
MEMEDTST.DCT - "
MEMEDTST.HLP - "
MEMEDTST.PR - "
LETTERS.* - "
MEMOEDIT.PR - Project file
MEMOEDIT.CLA - Global library
MEBLOCK.CLA - Block operations
MECORE.CLA - Core editing
MEDELETE.CLA - Text deletion
MEDONE.CLA - Termination
MEEDIT.CLA - Main editing procedure
MEFILE.CLA - File-oriented operations
MEINIT.CLA - Initialization
MELINTBL.CLA - Line table handling
MEPACK.CLA - Memo packing/unpacking
MEREFORM.CLA - Reformatting
MESCRDEF.CLA - Screen defaults
MESCREEN.CLA - Screen handling
MEUTIL.CLA - Utility functions
MEWORD.CLA - Word-by-word movement
CLMEM.OBJ - Object file for 'C' style memory allocation
CLMEM.A - Source for above in TopSpeed assembler format
4.0 BUILD THE LIBRARIES
------------------------
MemoEdit is implemented as a Clarion Library. The entire library is
Clarion source, with the exception of the file CLMEM.OBJ, which is a
TopSpeed Assembler object file. (We supply the OBJ file so you don't
need to purchase the TopSpeed TechKit just to recompile the libary.)
The project file which builds the library is MEMOEDIT.PR. You need to
build a library for each for each memory model (Static, Overlay,
Protected) and DLL/non-DLL setting you will be using with your apps.
The project file uses the %clapfx% macro to automatically generate
unique library names for each memory model:
DDVMEMED.LIB - Overlay w/DLL model library
DESMEMED.LIB - Extended w/DLL " "
DEVMEMED.LIB - Extended non-DLL " "
DOVMEMED.LIB - Overlay non-DLL " "
DXVMEMED.LIB - Static " "
DDVMEMED.DLL - Overlay model DLL
DESMEMED.DLL - Extended model DLL
5.0 RUN THE DEMO APPLICATION
-----------------------------
Before attempting to integrate MemoEdit into your own applications, be
sure to generate, compile, and run MEMEDTST.APP, the demo application.
6.0 USING MEMOEDIT
-------------------
6.1 EDITING KEYS
The following editing keys are implemented:
Up arrow - Standard Clarion Editor cursor navigation keys
Down arrow - "
Left arrow - "
Right arrow - "
Home - "
End - "
PgUp - "
PgDn - "
Ctrl-PgUp - "
Ctrl-PgDn - "
Ctrl-Left - Move to previous word
Ctrl-Right - Move to next word
Ctrl-Home - Erase entire line
Ctrl-End - Erase to end of line
Ctrl-M - Move text block
Ctrl-C - Copy text block
Ctrl-D - Delete text block
Ctrl-G - Insert text file at cursor
Ctrl-P - Copy marked block to text file
Ctrl-O - Toggle format code display on/off
6.2 FEATURES
DYNAMIC PARAGRAPH FORMATTING - MemoEdit automatically wordwraps and
reflows text into paragraphs as you insert or delete characters.
BLOCK OPERATIONS - MemoEdit supports Block Copy, Block Move, and Block
Delete functions. They behave in the same way as those in the
Clarion Editor.
'HARD' CARRIAGE RETURNS - MemoEdit supports 'hard' carriage returns,
allowing better control of the paragraph formatting process. When
you press the <Enter> key, a code of hex FF will be inserted into
the memo. The paragraph reformatting functions will stop flowing
text lines together when this code is encountered.
SHOW/HIDE FORMAT CODES - Pressing <Ctrl-O> will toggle the display of
formatting codes. The only formatting code currently used is the
'hard' carriage return described above. It will display as a ''
character.
6.3 MEMOEDIT HELP SCREEN
A Clarion Help screen listing the default key assignments used in
MemoEdit is included in the file MEMEDTST.HLP, supplied on the
distribution disk. You can use the Clarion Help utility to copy the
screen into your application's help file.
6.4 INSERTING ARBITRARY TEXT AT THE CURSOR POSITION
At any time, you may use the SM_InsTxt() function to insert an
arbitrary amount of text at the cursor position. For example, you
could define a hot key which calls a Browse procedure listing various
"boilerplate" text the user can insert into the document.
Assume the boilerplate text you wish insert is stored in the string
'sText'. The following code would insert the text at the current
cursor position and display the result:
SM_InsTxt(MED:usPosition, LEN(CLIP(sText)), sText) ! Insert text
SM_ReformDoc() ! Reformat document
SM_ShowPage() ! Redisplay page
7.0 KNOWN BUGS AND LIMITATIONS
-------------------------------
1) You may get a duplicate symbol warning for 'TYPE$GUSERDEFS'. This
is annoying, but harmless.
2) The mouse support is somewhat lacking: To edit the memo, you need
to click on the ME_Dummy field's prompt string. Clicking on the
memo area does not work as expected.
8.0 INTEGRATING MEMOEDIT INTO YOUR GENERATOR-BASED APPS
-------------------------------------------------------
1) Press Ctrl-O to display the Application Properties screen. Select
'Global Settings'. On the Global Settings screen, select 'Source'
to display the Embedded Source screen. Select the 'Inside Global
MAP' embed point, and enter the following statement:
INCLUDE('MEMOEDIT.MOD')
Press Ctrl-X to return to the Embedded Source screen.
2) Select the 'Data Section' embed point, and enter the following
statements:
INCLUDE('MEMOEDIT.EQU')
INCLUDE('MEMOEDIT.DEC')
Now for each file containing a memo, define a string array alias
over the memo. The length of the string element should be the same
as the defined display width of the memo as specified in the Data
Dictionary. The product of the STRING size and the DIM attribute
should be equal to the maximum defined size of the memo. For
example, assume the file shown below has a memo of 3800 characters,
with a defined display width of 76 characters:
LETTERS FILE,PRE(LET),CREATE,RECLAIM,DRIVER('CLARION')
ByLetterID KEY(LET:LetterID),NOCASE,OPT
LetterText MEMO(3800) ! 3800 characters
RECORD RECORD
LetterID LONG
LetterDesc STRING(40)
. .
You would enter the following code in the 'Data Section':
LetMemoGrp GROUP,OVER(LET:LetterText) ! Width is 76 and
LET_Memo STRING(76),DIM(50) ! 76 * 50 = 3800
.
3) Press Ctrl-X to return to the Embedded Source screen, then select
'Exit' to return to the Global Settings screen.
4) Select 'Data' from the Global Settings screen. Press <Ins> to
create a new data element. Create a data element called 'ME_Dummy'
of type 'STRING', length '1', and a display picture of 'P*P'.
Press Ctrl-X, and 'Ok' twice to return to the Procedure Worksheet.
5) For each form which allows the user to edit a memo, press <Enter>
to display the Procedure Properties screen, then select 'Source' to
display the Embedded Source screen. There are 3 embed points which
need code inserted as follows:
a) 'Setup Screen' embed point:
DISPLAY ! Display screen
ME_InitMemo( xxx_Memo ) ! Initialize memo
ME_ScrnDefs(ROW(?ME_Dummy)+1, COL(?ME_Dummy)+1,| ! Set screen area
rows, cols) !
(you can insert code to override defaults here - see Document
Variables section)
ME_Pack( xxx_Memo ) ! Pack the memo
ME_ShowPage() ! Display memo
WHERE: 'xxx' is the file prefix, and 'rows' and 'cols' are the
rows and columns in the memo editing area.
NOTE: 'rows' and 'cols' need not be the same as the size
defined in the Data Dictionary definition. If the
width is different the text will automatically be
rewrapped to fit.
b) 'Before File I/O' embed point:
ME_Unpack( xxx_Memo, SIZE(xxx_Memo[1])) ! Unpack memo before saving
WHERE: 'xxx' is the file prefix
c) 'End of Procedure' embed point:
ME_Done() ! Clean-up memory
6) For each form which allows the user to edit a memo, place the
'ME_Dummy' field on the screen layout. The field should be placed
immediately above and to the left of the position at which you want
the upper left-hand corner of the memo editing area to be located.
On the Entry Field Properties screen, select the 'When Screen Field
is Completed' Source button and enter the following statement:
INCLUDE('MEDUMMY.CLA') ! Include event loop code
7) On the Project Settings screen, select 'Module' and add the
following module as a 'External OBJ/LIB File':
%clapfx%memed.lib
9.0 EDITING ASCII FILES
------------------------
MemoEdit allows editing of ASCII text files as well as Clarion memo
fields. The maximum file size that can be edited is limited to
available memory. Two procedures to support the editing of ASCII text
files are provided:
ME_EditFile() Edits an ASCII text file
ME_PickFile() File picklist with directory navigation
Here is an example:
sFileName = ME_PickFile() ! Let user select a file
IF sFileName ! If selection made
ME_EditFile( sFileName ) ! Edit the file
. ! Endif
The default 'Save' and 'Cancel' keys are Ctrl-Enter and Escape,
respectively. You can change these by assigning new keycodes to
the global variables MEU:isFlSaveKey and MEU:isFlCancKey.
10.0 TECHNICAL STUFF
---------------------
10.1 VARIABLE NAMING CONVENTION
In the sections that follow, lowercase letters are used before
variable names to indicate the variable type:
bb Boolean Byte (BYTE )
is Integer Short (SHORT )
il Integer Long (LONG )
q Queue (QUEUE )
s String (STRING)
ub Unsigned Byte (BYTE )
ul Unsigned Long (ULONG )
us Unsigned Short (USHORT)
10.2 GLOBAL VARIABLES
The following global variables are available for run-time
customization:
MEU:sHelpID
Determines the ID of the Help screen which is displayed when F1
is pressed while editing a memo. The default value is
'MEMOEDIT'.
MEU:bbShowStatus
If non-zero, causes a status bar to be displayed on the screen row
specified by MEU:ubStatus row. Setting this to zero disables the
status bar. The default is to display the status bar.
MEU:ubStatusRow
If MEU:bbShowStatus is non-zero, this variable determines the
screen row at which to display the status bar. The default is row
25.
MEU:bbAlrtBfrCmd
If non-zero, causes ALERTed keys to have priority over built-in
editing keys in the case of a key conflict. Setting this to zero
will cause editing keys to have priority. The default is for
ALERTed keys to have priority.
MEU:ubAscImpFmt
Determines the import method when reading an ASCII file into a
document via Ctrl-G. There are 3 predefined EQUATE values:
eImpRefNone !Convert all CR's to hard returns.
eImpRefPart !Convert 2 or more occurrences of CR's to hard returns.
eImpRefFull !Ignore CR's and treat text as a stream
MEU:ubAscExpFmt
Determines the export method when writing a marked block to an
ASCII file via Ctrl-G. Currently, there are 2 predefined EQUATE
values:
eExpKillCode !Strip all format codes
eExpKeepCode !Keep all codes
In MemoEdit the only format code currently defined is the Hard
Return (ASCII 255).
MEU:isFlSaveKey
Sets keycode which causes a 'Save and Exit' operation when editing
a file. The default keycode is Ctrl-Enter.
MEU:isFlCancKey
Sets keycode which causes a 'Cancel' operation when editing a
file. If the file has been changed the user will be asked to
confirm before exiting. The default keycode is Escape.
qClipboard
After any block operation, the most recently marked text is stored
in this queue. The structure is:
qClipboard QUEUE,PRE(MEB),EXTERNAL !Clipboard for block
STRING(255) !operations
.
10.3 DOCUMENT QUEUE STRUCTURE
Each document being edited has an associated record in the global
queue qDocument with the following structure:
qDocument QUEUE,PRE(MED),EXTERNAL !Table of document structures:
ubWndRowOfs BYTE ! Edit window row offset
ubWndColOfs BYTE ! Edit window column offset
ubWndRows BYTE ! Edit window rows
ubWndCols BYTE ! Edit window columns
usLineWidth USHORT ! Line width
ubTextColor BYTE ! Normal text color
ubSymColor BYTE ! Format code color
ubBlockColor BYTE ! Block marking color
bbInsertMode BYTE ! Insert/overwrite flag
bbShowCodes BYTE ! Display format codes flag
bbBlockShow BYTE ! Marked block display flag
bbBlockMark BYTE ! Block marking mode flag
isBlockBegin SHORT ! Start of marked text block
isBlockEnd SHORT ! End of marked text block
bbAllocFlag BYTE ! Buffer allocation flag (*RESERVED*)
ulEditBuffer ULONG ! Pointer to edit buffer (*RESERVED*)
usCharacters USHORT ! Current # of chars document
usMaxChars USHORT ! Max. chars allowed in buffer
bbHasChanged BYTE ! Edit buffer changed flag
usPageTop USHORT ! Line at current top-of-page
usLineNdx USHORT ! Current line index
isSkew SHORT ! Horizontal skew increment
usPosition USHORT ! Current point position
usLineStart USHORT ! Current line start offset
usLineEnd USHORT ! Current line end offset
.
10.4 DOCUMENT VARIABLES
The following document variables may be overridden after initially
calling ME_ScrnDefs():
MED:usLineWidth
Determines the word wrap column when editing and displaying text.
The initial default is set to the size of the editing window, so
text wraps within the window. This can be increased to suppress
wordwrap. Note that by changing this value, you can cause the
text to rewrap to any desired column width - the editing window
does *not* have to be the same width as the defined width of the
memo field definition.
MED:ubTextColor
Determines the color code used to display normal text.
MED:ubSymColor
Determines the color code used to display format codes when Ctrl-O
is used.
MED:ubBlockColor
Determines the color code used to mark text blocks during block
operations.
MED:bbInsertMode
A value of 1 indicates insert mode, while a value of 0 indicates
overwrite mode.
MED:bbShowCodes
A value of 1 suppresses the display of format codes. A value of
zero displays format codes as graphic characters using the color
code MED:ubSymColor. In MemoEdit, the only format code is the
Hard Return, which displays as a '' character.
MED:bbBlockShow
This flag determines whether the text block region determined by
MED:isBlockBegin and MED:isBlockEnd should be displayed as
highlighted in the color MED:ubBlockColor. A value of 1 displays
the block, while a value of 0 hides the block.
MED:bbBlockMark
This flag turns block marking mode on and off. A value of 1
indicates that block marking mode is on, and MED:isBlockEnd should
be updated as the cursor is moved. A value of 0 turns off block
marking mode.
MED:isBlockBegin
Contains the 0-based offset into the edit buffer of the first
character in the currently marked block.
MED:isBlockEnd
Contains the 0-based offset into the edit buffer of the last
character in the currently marked block.
MED:usCharacters
This value may be read to determine the current number of
characters in the edit buffer. *DO NOT CHANGE THIS VALUE!*
MED:bbHasChanged
This flag indicates whether the contents of the edit buffer have
since it was initially loaded.
MED:usLineIndex
This value may be read to determine the current document line
index. *DO NOT CHANGE THIS VALUE!*
10.5 USEFUL FUNCTIONS AND PROCEDURES
The following functions are the most commonly used. Refer to the
source code for any others:
ME_BuffrFull(), BYTE
Returns 1 if there is no more room to insert characters in the
buffer.
ME_DelTxt( usDeletePos, usDeleteCount )
Deletes usDeleteCount characters, starting at usDeletePos.
ME_InsTxt( usInsertPos, usStringLength, sTextString )
Inserts the string sTextString into the edit buffer at
usInsertPos.
ME_Pack( aBuffer, <bbKeepFormat> )
Packs the memo array 'aBuffer' by removing trailing blanks from
each line. This effectively converts the standard Clarion format
memo into a straight stream of text representation which is more
suited for word processing. Setting the optional 'bbKeepFormat'
flag to 1 will append a Hard Return after each line of the memo.
This will cause lines to break in the same place they would if you
were using a standard Clarion TEXT field.
ME_PasteClip()
Pastes the contents of qClipboard at the current cursor position.
ME_ReformDoc()
Reformats the entire document.
ME_SetPage()
Invalidates the entire current display page so that a subsequent
call to ME_ShowPage() will redraw the entire page.
ME_ShowPage()
Refreshes the display, updating only those portions of the screen
that need to be updated.
ME_Unpack( aMemo, usLineWidth )
Undoes the effects of the ME_Pack() procedure, converting the
straight stream of text representation back into the Clarion
fixed-width array format.
11.0 QUESTIONS?
----------------
The source for MemoEdit is fairly well commented, but if you have any
questions or suggestions feel free to E-Mail me at CIS ID [70441,204]
or phone (914)-762-2374.